package com.xyht.sca_s.student_manage_system.modules.carUseManage.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xyht.sca_s.student_manage_system.modules.carUseManage.entity.SmsCarUseApplicationProcess;
import com.xyht.sca_s.student_manage_system.modules.carUseManage.mapper.SmsCarUseApplicationProcessMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CarUseApplication {
    @Autowired
    private SmsCarUseApplicationProcessMapper smsCarUseApplicationProcessMapper;

    private String[] departmentNameArray = {"财务部"};
    @Bean
    public void carUseApplicationInit() {
        List<SmsCarUseApplicationProcess> processList =
                smsCarUseApplicationProcessMapper.selectList(new QueryWrapper<>());
        if (processList == null || processList.size() < 1) {
            int sort = 1;
            for (String departmentName : departmentNameArray) {
                SmsCarUseApplicationProcess addProcess =
                        new SmsCarUseApplicationProcess();
                addProcess.setProcessName(departmentName);
                addProcess.setProcessIsUse(true);
                addProcess.setProcessIsStamp(false);
                addProcess.setProcessIsSign(true);
                addProcess.setProcessIsApplicationEdit(false);
                addProcess.setProcessSort(sort++);
                smsCarUseApplicationProcessMapper.insert(addProcess);
            }


        }
    }


}
